package indi.woniu.service.impl;

import indi.woniu.entity.Paper;
import indi.woniu.mapper.TestPaperDao;
import indi.woniu.service.TestPaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author venture
 */
@Service
public class TestPaperServiceImpl implements TestPaperService {
    @Autowired(required = false)
    private TestPaperDao testPaperDao;
    @Override
    public List<Paper> findAllTestPaper() {
        List<Paper> paperList =  testPaperDao.finAllTestPaper();
        for (Paper paper : paperList) {
            paper.getSubjects();
        }
        return paperList;
    }

    @Override
    public int add(Paper paper) {
        int i  = testPaperDao.addTestPaper(paper);

        return i;
    }

    @Override
    public int deleteById(int id) {
        return testPaperDao.deleteById(id);
    }

    @Override
    public int updateById(Paper paper) {
        return testPaperDao.updateById(paper);
    }

    @Override
    public Map<String,Object> findById(Integer id) {
        return testPaperDao.findById(id);
    }
}
